/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alloytoy;

import java.util.*;

/**
 * Directed Graph representation.
 * @author Daniel
 */

public class Digraph{
    public int V;
    private List<Integer>[] adj;
    public Digraph(int V){
        this.V = V;
        adj = new ArrayList[V];
	for(int v=0; v<V; v++)
            adj[v] = new ArrayList<Integer>();
	}

	public void insert(int v, int w){
            adj[v].add(w);
	}

	public Iterable<Integer> adj(int v){
            return adj[v];
	}

	public void printGraph(){
            for(int v=0; v<adj.length; v++)
                System.out.println(adj[v]);
	}
}
